package teg

import (
	"encoding/json"
	"errors"
)

const (
	Ping = 0
	Pong = 1
)

var ErrPingPong = errors.New("pingpong proto errors")

type PingPong struct {
	T   int    `json:"t"` // 0:ping 1:pong
	Say string `json:"say"`
}

func MakeMsg(v int, body string) string {
	var pp = PingPong{}
	pp.T = v
	pp.Say = body
	msg, _ := json.Marshal(pp)
	return string(msg)

}
